<?php
namespace app\adminmall\controller;
use app\common\controller\AdminBaseController;
use think\Db;

/**
 * 商家销量统计
 */
class MsalesController extends AdminBaseController {
	
	public function index(){
		 $list=Db::name('mall_goods_discount')
	 	->alias('g')
	 	->join('mall_agent b','g.agent_id=b.id','RIGHT')
	 	->field('g.*,b.store_name')
	 	->order('sales desc')
	 	->paginate(10);  
	 	
        return $this->fetch('index', ['list' => $list]);
	}
	
	 /**
     * 
     *查询
     * @author [longx] 
     */
    public function select(){
    	$p=[];
    	$param = input('post.');
    	//店铺名称		
    	if($param['store_name']){
	  		$p['store_name'] = ['like', '%'.$param['store_name'].'%'];
    	}
    	
    	$list=Db::name('mall_goods_discount')
	 	->alias('a')
	 	->join('mall_agent b','a.agent_id=b.id')
	 	->field('a.*,b.store_name')
	 	->where($p)
	 	->paginate(10);  
    	return $this->fetch('index',["list" =>$list ]);
    }
	
}
?>